/** Returns the number of leap years between year1 and year2, inclusive. 
 * Precondition: 0 <= year1 <= year2
 */
public static int numberOfLeapYears(int year1, int year2)
{
    int count = 0;
    for (int i = year1; i <= year2; i++)
    {
        if (isLeapYear(i))
        {
            count++;
        }
    }
    return count;
}